import numpy as np
arr = np.array([[110, 120, 90, 80],[89, 95, 77, 92],[60, 79, 96, 80]])
print('3*4的数组:\n',arr)
print('第3行和第1行的元素:\n', arr[[2, 0]])
print('第3行第2列和第1行第1列的元素:\n', arr[[2, 0],[1, 0]])
print('大于80且小于等于100的所有元素: ',arr[(arr>80)&(arr<=100)])
print('小于等于80的所有元素: ',arr[arr<=80])


import numpy as np
arr = np.array(object[[11,13,18],[45,46,78],[15,87,33]])
print('第2行第3列的元素:',arr[1,2])



import numpy as np
arr1 = np.array([[10, 20, 30],[40, 50, 60]])
print('2*3的数组arr1: \n', arr1)
arr2 = np.array([[1, 2, 2], [2, 2, 3]])
print('arr1与arr2的加法运算: \n', arr1+arr2)
print('arr1与arr2的减法运算: \n', arr1-arr2)
print('arr1与arr2的乘法运算: \n', arr1*arr2)
print('arr1与arr2的除法运算: \n', arr1/arr2)
print('arr1与arr2的幂运算: \n', arr1**arr2)


import numpy as np
arr1 = np.random.randint(1, 10, size=(3, 3))
print('随机生成的二位整数数组arr1: \n', arr1)
arr2 = np.random.randint(1, 10, size=3)
print('随机生成的一维整数数组arr2: \n', arr2)
arr3 = np.random.rand(3, 3) * 10
print('随机生成的二维小数数组arr3: \n', arr3)
print('arr1和arr2相加: \n', np.add(arr1, arr2))
print('arr1和arr2相乘: \n', np.multiply(arr1, arr2))
print('以arr1为底数,arr2为指数的幂: \n', np.power(arr1, arr2, dtype='int64'))
print('arr1的倒数: \n', np.reciprocal(arr1, dtype='float'))
print('arr3四舍五入, 小数点后保留最后一位: \n', np.around(arr3, decimals=1))
print('arr1的余弦值: \n', np.cos(arr1 * pi / 180))